<template>
  <div>
    <div v-show="!isShow">
      <jxf-titletip :title="title + '（' + (activeName ==='first' ? '采购商' : '供应商') + '）'" :hasRefresh="false"></jxf-titletip>
      <el-tabs class="bg-white mt20 pd20" v-model="activeName">
        <el-tab-pane label="采购商" name="first">
          <MerchantStartManagement ref="MerchantStartManagement" @showDetail="showDetail"></MerchantStartManagement>
        </el-tab-pane>
        <el-tab-pane label="供应商" name="second">
          <SupplierStartManagement ref="SupplierStartManagement" @showDetail="showDetail"></SupplierStartManagement>
        </el-tab-pane>
      </el-tabs>
    </div>
    <ShowStarDetail ref="ShowStarDetail" :isShow.sync="isShow" v-show="isShow" @refreshPage = "refreshPage"></ShowStarDetail>
  </div>
</template>

<script>
  import SupplierStartManagement from './SupplierStartManagement'
  import MerchantStartManagement from './MerchantStartManagement'
  import ShowStarDetail from './components/ShowStarDetail'

  export default {
    name: "StartManagement",
    components: {SupplierStartManagement,MerchantStartManagement,ShowStarDetail},
    data() {
      return {
        title: "信用管理",
        activeName: "first",
        isShow: false
      }
    },
    methods: {
      showDetail(info) {
        this.isShow = true
        this.$refs.ShowStarDetail.getDetail(info)
      },
      refreshPage(userType){
        if(userType === 1){
          this.$refs.MerchantStartManagement.getList()
        }else{
          this.$refs.SupplierStartManagement.getList()
        }
      }
    },
    created() {
    }
  }
</script>

<style lang="scss" scoped>

</style>
